<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
	<title>Test TextModel</title>
	<link rel="stylesheet" href="../qunit/qunit.css" type="text/css" media="screen">
	<script type="text/javascript" src="../qunit/qunit.js"></script>
    <script src="../../lib/NxIDE/Utils.js"></script>
    <script src="../../lib/NxIDE/DOMUtils.js"></script>
    <script src="../../lib/NxIDE/Eventable.js"></script>
    <script src="../../lib/NxIDE/text/TextModel.js"></script>
    <script src="../../lib/NxIDE/text/LineTracker.js"></script>
</head>
<body>
	<h1 id="qunit-header">QUnit Test Suite</h1>
	<h2 id="qunit-banner"></h2>
	<div id="qunit-testrunner-toolbar"></div>
	<h2 id="qunit-userAgent"></h2>
	<ol id="qunit-tests"></ol>
	<div id="qunit-fixture">test markup</div>
<script>
    test('set', function (){
        var textModel = new TextModel();
        textModel.setText('123');
        var lineTracker = new LineTracker(textModel);
        equals(lineTracker.getLineCount(), 1);
        textModel.setText('123242\n');
        equals(lineTracker.getLineCount(), 2);
        textModel.setText('123242\n123131\r\n123');
        equals(lineTracker.getLineCount(), 3);
        textModel.setText('\n\n13123');
        equals(lineTracker.getLineCount(), 3);
    });
    test('change', function (){
        var textModel = new TextModel();
        textModel.setText('\n\n\n');
        var lineTracker = new LineTracker(textModel);
        equals(lineTracker.getLineCount(), 4);
        textModel.setText('123242', 1, 2);
        equals(lineTracker.getLineCount(), 3);
    });
</script>
</body>
</html>